<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
		<meta charset="UTF-8">
		<title></title>
<link rel="stylesheet" href="/wk2un10/houtai/lib/layui/css/layui.css">
   
	</head>
	<body>
		<form class="layui-form">
			<div class="layui-form-item">
				<label class="layui-form-label"><span style="color: red;">*</span> ID</label>
				<div class="layui-input-inline">
					<input type="text" name="id" required lay-verify="required" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><span style="color: red;">*</span>是否显示</label>
				<div class="layui-input-inline">
					<input type="text" name="homeFlag" required lay-verify="required" autocomplete="off" class="layui-input">
				</div>
			</div>
			 
			<div class="layui-form-item">
				<label class="layui-form-label"><span style="color: red;">*</span> 名称</label>
				<div class="layui-input-inline">
					<input type="text" name="proName" required lay-verify="required" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><span style="color: red;">*</span> 类型</label>
				<div class="layui-input-inline">
					<input type="text" name="proMateral" required lay-verify="required" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><span style="color: red;">*</span>产品售价</label>
				<div class="layui-input-inline">
					<input type="text" name="salePrice" required lay-verify="required" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><span style="color: red;">*</span>市场价格</label>
				<div class="layui-input-inline">
					<input type="text" name="marketPrice" required lay-verify="required" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><span style="color: red;">*</span> 品牌</label>
				<div class="layui-input-inline">
					<input type="text" name="brand" required lay-verify="required" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><span style="color: red;">*</span> 是否组装</label>
				<div class="layui-input-inline">
					<input type="text" name="zuZhuang" required lay-verify="required" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><span style="color: red;">*</span> 是否可定制</label>
				<div class="layui-input-inline">
					<input type="text" name="dingZhi" required lay-verify="required" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><span style="color: red;">*</span> 型号</label>
				<div class="layui-input-inline">
					<input type="text" name="model" required lay-verify="required" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><span style="color: red;">*</span> 颜色</label>
				<div class="layui-input-inline">
					<input type="text" name="color" required lay-verify="required" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><span style="color: red;">*</span> 设计</label>
				<div class="layui-input-inline">
					<input type="text" name="yuanSu" required lay-verify="required" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><span style="color: red;">*</span> 风格</label>
				<div class="layui-input-inline">
					<input type="text" name="styles" required lay-verify="required" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><span style="color: red;">*</span> 款式定位</label>
				<div class="layui-input-inline">
					<input type="text" name="kuanShi" required lay-verify="required" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
   					 <label class="layui-form-label">
   					 <span style="color: red;">*</span>系列型</label>
    				<div class="layui-input-block">
      					<select name="productTypeId" lay-verify="required">
      					<c:forEach items="${u}" var="u">
       						<option value="${u.id}"> ${u.productTypeName}</option>
        					
        				</c:forEach>
      					</select>
    				</div>
  			</div>
			<div class="layui-form-item">
				<div class="layui-input-block">
					<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
					<button type="reset" class="layui-btn layui-btn-primary">重置</button>
				</div>
			</div>
		</form>
		<script type="text/javascript" src="/wk2un10/houtai/lib/layui/layui.js"></script>
			<script>
	//加载了layui的form模块
	layui.use('form', function() {
		var form = layui.form;
		var $ = layui.jquery; //引入jquery
		//监听提交
		form.on('submit(formDemo)', function(data) {
			var d = data.field; //表单中的数据，定义一个对象来接收
			//通过ajax向数据库提交数据了
			d.method="update";
			var url ='/wk2un10/productSqlServlet';
			//确保数据没有问题就进行ajax提交了
			$.post(url, d,
				function(data) {
					if(data.count>0){//对应Result里面的count
						console.log('添加成功');
						var index=parent.layer.getFrameIndex(window.name); //获取当前窗口的name
     					 parent.layer.close(index);		//关闭窗口
					}
				}, "json");
			return false;
		});
	});
	</script>
	</body>
</html>

